#ifndef PROTOCOL_TRANSPORT_H
#define PROTOCOL_TRANSPORT_H

#include <esp_types.h>

typedef enum
{
    PROTOCOL_TRANSPORT_TYPE_WEBSOCKET = 0,
    PROTOCOL_TRANSPORT_TYPE_MQTT,
} protocol_transport_type_t;

typedef struct
{
    void (*audio_callback)(void *protocol, void *data, size_t len);
    void (*text_callback)(void *protocol, char *text);
    void (*channel_close_callback)(void *protocol);
} protocol_transport_callbacks_t;

typedef struct protocol_transport
{
    protocol_transport_type_t type;
    void (*start)(struct protocol_transport *transport);
    bool (*open_audio_channel)(struct protocol_transport *transport);
    void (*close_audio_channel)(struct protocol_transport *transport);
    bool (*is_audio_channel_open)(struct protocol_transport *transport);
    void (*send_audio)(struct protocol_transport *transport, void *data, size_t len);
    void (*send_text)(struct protocol_transport *transport, char *text);
    void (*deinit)(struct protocol_transport *transport);
} protocol_transport_t;

protocol_transport_t *protocol_transport_create_websocket(protocol_transport_callbacks_t *callbacks, void *protocol);

// protocol_transport_t *protocol_transport_create_mqtt(protocol_transport_callbacks_t *callbacks, void *protocol);
#endif